#include "SoPhuc.h"

int main()
{
	cout << "MENU: \n";
	cout << "1 - Phep cong hai so phuc\n";
	cout << "2 - Phep tru hai so phuc\n";
	cout << "3 - Phep nhan hai so phuc\n";
	cout << "4 - Phep chia hai so phuc\n";
	cout << "5 - Phep += \n";
	cout << "6 - Phep -=\n";
	cout << "7 - Phep *=\n";
	cout << "8 - Phep /=\n";
	cout << "0 - ket thuc chuong trinh\n";
	int  ketthuc;
	SoPhuc a, b, temp;
	do
	{
		cout << "Nhap phep toan ban muon thuc hien: ";
		cin >> ketthuc;
		if (ketthuc != 0)
		{
			cout << "Nhap so phuc thu nhat: \n";
			a.Nhap();
			cout << "Nhap so phuc thu hai: \n";
			b.Nhap();
			temp = a;
			switch (ketthuc)
			{
			case 1:
				temp = a + b;
				cout << "Ket qua phep +: ";
				break;
			case 2:
				temp = a - b;
				cout << "Ket qua phep -: ";
				break;
			case 3:
				temp = a * b;
				cout << "Ket qua phep *: ";
				break;
			case 4:
				temp = a / b;
				cout << "Ket qua phep /: ";
				break;
			case 5:
				temp += b;
				cout << "Ket qua += : ";
				break;
			case 6:
				temp -= b;
				cout << "ket qua -= : ";
				break;
			case 7:
				temp *= b;
				cout << "Ket qua *= : ";
				break;
			case 8:
				temp /= b;
				cout << "Ket qua /=: ";
				break;
			default:
				cout << "Phep toan ban nhap khong co trong danh sach!";
			}			
			temp.Xuat();
			cout << endl;
		}	
	} while (ketthuc != 0);
	return 0;
}